<script setup>
import { ref } from 'vue'
import TaskBoard from '../components/Taskboard.vue'
import MemberList from '../components/MemberList.vue'
import Analytics from '../components/Analytics.vue'

const activeTab = ref('tasks')
</script>

<template>
  <div class="home-view">
    <header class="app-header">
      <div class="header-content">
        <h1>智能任务管理系统</h1>
        <nav class="tabs">
          <button 
            v-for="tab in ['tasks', 'members', 'analytics']"
            :key="tab"
            :class="{ active: activeTab === tab }" 
            @click="activeTab = tab"
          >
            {{ 
              tab === 'tasks' ? '任务看板' : 
              tab === 'members' ? '成员管理' : '数据分析' 
            }}
          </button>
        </nav>
      </div>
    </header>

    <main class="app-main">
      <div class="container">
        <transition name="fade" mode="out-in">
          <component 
            :is="
              activeTab === 'tasks' ? TaskBoard : 
              activeTab === 'members' ? MemberList : Analytics
            " 
            :key="activeTab"
          />
        </transition>
      </div>
    </main>
  </div>
</template>

<style scoped>
.home-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: linear-gradient(135deg, #42b983 0%, #3498db 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.8rem;
  text-align: center;
}

.tabs {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  justify-content: center;
}

.tabs button {
  padding: 0.5rem 1.5rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 20px;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
}

.tabs button.active {
  background: white;
  color: #42b983;
  font-weight: bold;
}

.app-main {
  flex: 1;
  padding: 2rem 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>